const express = require('express');
const path = require('path');
const app = express()
const {
  createProxyMiddleware
} = require('http-proxy-middleware');
const options = {
  target: 'http://localhost:10000',
  changeOrigin: true,
  ws: true,
  secure: true,
  pathRewrite: {
    '/API': '/API',
  },
};

app.use('/', express.static(path.join(__dirname, 'public')));

app.use('/API', createProxyMiddleware(options));

app.listen(8080, () => {
  console.log("proxy start 8080")
})